const state = () => ({
    applicationRefundsData: {}, // 申请退款所需数据
})


const mutations = {
    /** 退款相关 begin */
    /**
     * 保存申请退款所需数据
     * @param {*} state 
     * @param {Object} provider 
     * @prop { String } provider.orderId // 订单id
     * @prop { Boolean } provider.applied // 是否已经申请退款
     * @prop { Boolean } provider.isBatch // 是否批量退款
     * @prop { Array } provider.list // 退款的商品列表{ orderGoodsId: 订单商品id, refundsNumber: 退款数量 }
     */
    saveApplicationRefundsData(state, provider) {
        state.applicationRefundsData = Object.assign({}, state.applicationRefundsData, provider);
        console.log(state.applicationRefundsData);
    },

    // 清除申请退款所需数据
    removeApplicationRefundsData(state) {
        state.applicationRefundsData = {};
    },
    /** 退款相关 end */
}


export default {
    namespaced: true,
    state,
    mutations,
}